package org.bbl.web;

import org.apache.wicket.RestartResponseAtInterceptPageException;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxFallbackLink;
import org.apache.wicket.markup.html.panel.Panel;

/**
 * @author biniam.gebremichael
 * @since 4/22/13
 */
public class ParallelPage extends Panel {
    public ParallelPage(final String id, final Integer bookId,
                        final Integer chapterId, final Integer languageId, final Integer ln2) {
        super(id);

        long start = System.currentTimeMillis();
        add(new AjaxFallbackLink<Void>("single"){
            @Override
            public void onClick(AjaxRequestTarget ajaxRequestTarget) {
                throw new RestartResponseAtInterceptPageException(new HomePage(bookId,chapterId,languageId,null));

            }
        }) ;

        add(new ListPage("first", bookId, chapterId, languageId));
        System.out.println("built 1 in = " + (System.currentTimeMillis() - start));
        add(new ListPage("second", bookId, chapterId, ln2));
        System.out.println("built 2 in = " + (System.currentTimeMillis() - start));
    }
}
